<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑门店</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/app/admin/component/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" media="all">
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body">
                <form class="layui-form" lay-filter="store-form">
                    <input type="hidden" name="id" value="<?php echo $store->id; ?>">
                    <div class="layui-form-item">
                        <label class="layui-form-label">门店名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" value="<?php echo $store->name; ?>" lay-verify="required" placeholder="请输入门店名称" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">门店地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="address" value="<?php echo $store->address; ?>" lay-verify="required" placeholder="请输入门店地址" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">联系电话</label>
                        <div class="layui-input-block">
                            <input type="text" name="phone" value="<?php echo $store->phone; ?>" lay-verify="required|phone" placeholder="请输入联系电话" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">营业时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="business_hours" value="<?php echo $store->business_hours; ?>" placeholder="请输入营业时间，如：09:00-22:00" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">负责人</label>
                        <div class="layui-input-block">
                            <input type="text" name="manager_name" value="<?php echo $store->manager_name; ?>" placeholder="请输入负责人姓名" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">负责人电话</label>
                        <div class="layui-input-block">
                            <input type="text" name="manager_phone" value="<?php echo $store->manager_phone; ?>" lay-verify="phone" placeholder="请输入负责人电话" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-block">
                            <input type="radio" name="status" value="1" title="启用" <?php echo $store->status == 1 ? 'checked' : ''; ?>>
                            <input type="radio" name="status" value="0" title="禁用" <?php echo $store->status == 0 ? 'checked' : ''; ?>>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <textarea name="remark" placeholder="请输入备注" class="layui-textarea"><?php echo $store->remark; ?></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="store-form-submit">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <script src="/app/admin/component/layui/layui.js"></script>
    <script src="/app/admin/component/pear/pear.js"></script>
    <script>
    layui.use(['form', 'layer'], function(){
        var $ = layui.$
        ,form = layui.form
        ,layer = layui.layer;
        
        //监听提交
        form.on('submit(store-form-submit)', function(data){
            var field = data.field;
            
            //提交数据
            $.ajax({
                url: '/app/ky_shouyin/admin/store/edit'
                ,type: 'POST'
                ,data: field
                ,success: function(res){
                    if(res.code === 0){
                        layer.msg('编辑成功', {
                            icon: 1
                            ,time: 1000
                        }, function(){
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.layui.table.reload('LAY-store-list');
                        });
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }
            });
            
            return false;
        });
    });
    </script>
</body>
</html> 